package com.jml.task.utils;

import org.I0Itec.zkclient.ZkClient;
import org.springframework.beans.factory.annotation.Value;


public class ZkClientUtils {
    private static ZkClient zkClient = null;

    public static ZkClient getZkClient() {
        return zkClient;
    }

    public static ZkClient newZkClient() {
        if (zkClient == null) {
            zkClient = new ZkClient("127.0.0.1:2181", 5000);
        }
        return zkClient;
    }

    public static void close() {
        if (zkClient != null) {
            zkClient.close();
            zkClient = null;

        }
    }
}
